#include "SR04.h"

SR04::SR04(int TP, int EP) {
	pinMode(TP, OUTPUT);
	pinMode(EP, INPUT_PULLUP);
	Trig_Pin = TP;
	Echo_PIn = EP;
}
float SR04::Jl_CM() {
	digitalWrite(Trig_Pin, LOW);
	delayMicroseconds(1);
	digitalWrite(Trig_Pin, HIGH);
	delayMicroseconds(10);
	digitalWrite(Trig_Pin, LOW);
	int dig = pulseIn(Echo_PIn, HIGH);
	
		float dj = dig / 59;
	return dj;
		

}
